package Model.StatisticalReport;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 报表统计查询
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ReportStatisticsQuery {
    private int page;
    private int start;
    private int size;
    private int count; //最大记录数（该值如果已经存在， 则不再进行计数查询）
    private boolean pagination;
    private int id;

    /**
     * 报表数据表名
     */
    private String schema;
    private String detailSchema;
    private String summarySchema;
    private int schemaId; //报表类型Id

    //时间
    @JsonFormat(pattern="yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date date; //根据date 查询
    @JsonFormat(pattern="yyyy-MM")
    @DateTimeFormat(pattern = "yyyy-MM")
    private Date yearMonth; //根据年月 查询
    @JsonFormat(pattern="yyyy-MM")
    @DateTimeFormat(pattern = "yyyy-MM")
    private Date daaMonth; //根据daa的 yyyy-mm查询
    private String daaYear; //根据daa的 yyyy 查询
    private int year;
    private int month;

    private String CLASS; //人员类型
    private int idvClassId; //人员类型Id
    private int reportId; //数据表类型
    private ReportClass report; //数据表


    private String type; //类型
    private int typeId; //类型Id

    private String YYNAME; //医院名字
    private String YYID; //ID

    public void setPagination(int start, int size){
        this.start = start;
        this.size = size;
        this.pagination = true;
    }

    public void removePagination(){
        this.pagination = false;
        this.count = 0;
    }


    public String toString(){
        return JSON.toJSONString(this, SerializerFeature.DisableCircularReferenceDetect,
                SerializerFeature.WriteDateUseDateFormat);
    }
}
